 var id = getvl("id");


 $(function(){
 	  if(id!=''){
 	  	 wodejinbi();
 	  	 wodejinbi2();
 	  	
 	  }else{
            alert("参数错误");
 	   }
 });
 
 var pageNo=1;
 var type=3;
 var ss=0;
 function wodejinbi(){
 	   if(pageNo==0 || pageNo==1 || pageNo==2 || ss!=0){
 	   	sss=0;
 	   	pageNos=1;
 	   	 $("#jinbimingxi2").html("");
		$.ajax({
 url: urlcore + "/api/goldRecord/selectGoldListByType2?current="+pageNo+"&type="+type+"&userId="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
		
				if(data.success == true) {
					ss=data.data.list.length;
					$.each(data.data.list, function(y,n) {
	
					var jinbimingxi='<dd class="clearfix">'+
'    			<div class="yue_list_left">'+
'    				<h5>'+n.title+'</h5>'+
'    				<span>'+n.gmtDatetime+'</span>'+
'    			</div>'+
'    			<div class="yue_list_right">+'+n.gold+'</div>'+
'    		</dd>';
                    $("#jinbimingxi").append(jinbimingxi);
				});
				} 
			},
			error: function() {
				alert("error");
			}
		});
		}
 }

var pageNos=1;
var sss=0;
 function wodejinbi2(){
 	if(pageNos==1 || pageNos==2 || sss!=0){
 	pageNo=1;
    ss=0;
     $("#jinbimingxi").html("");
 	$.ajax({
 url: urlcore + "/api/goldRecord/selectGoldListByType2?current="+pageNos+"&type=2&userId="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
			var creditLevel=data.data.creditLevel;
				if(data.success == true) {
					sss=data.data.list.length;
					$.each(data.data.list, function(y,n) {
	/*var gmtDatetime = new Date(n.gmtDatetime).pattern("yyyy-MM-dd hh:mm:ss");
		*/			var jinbimingxi2='<dd class="clearfix">'+
'    			<div class="yue_list_left">'+
'    				<h5>'+n.title+'</h5>'+
'    				<span>'+n.gmtDatetime+'</span>'+
'    			</div>'+
'    			<div class="yue_list_right">-'+n.gold+'</div>'+
'    		</dd>';
                    $("#jinbimingxi2").append(jinbimingxi2);
				});
				} 
			},
			error: function() {
				alert("error");
			}
		});
		}
 }



function  qiandao(){
		$.ajax({
 url: urlcore + "/api/goldRecord/signGold2?userId="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					var yemian=window.location.href;
					window.location.href=yemian;
				  //  alert("签到成功")
				}else{
					alert(data.msg);
				}
			},
			error: function() {
				alert("error");
			}
		});
 
	
}

selectGoldMsg();
function selectGoldMsg(){
	
		$.ajax({
 url: urlcore + "/api/goldRecord/selectGoldMsg?userId="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					$("#mingtian").html("明天签到可领取"+data.data.tomorrowGold+"金币");
					$("#guoqi").html("月底有"+data.data.overGold+"金币将过期");
					$("#jinbis").html(data.data.userGold);
				}else{
					alert(data.msg);
				}
			},
			error: function() {
				alert("error");
			}
		});
 
	

}
